<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			img{
				width: 400px;
				border-radius: 50%;
			}
		</style>
	</head>
	<body style="text-align: center;">
		<input type="button" value="开始" id="change" /><br /><br />
		<img src="1.jpg" id="image"/>
		<script>
			var imgs = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg"];
			image.src = imgs[0];
			var timer;
			change.onclick = function(){
				if(change.value == "结束"){
					clearInterval(timer);
					change.value = "开始";
				}else{
					timer = setInterval(f,500);
					change.value = "结束"
				}
			};
			function f(){
				image.src = imgs[Math.floor(Math.random()*imgs.length)];
			}
		</script>
	</body>
</html>
